package org.metasketch.editor;

import java.util.ArrayList;
import java.util.List;

public abstract class Project {

	// String name;
	protected List<IProjectListener> listeners = new ArrayList<IProjectListener>();

	protected String path;

	protected boolean dirty = false;

	// public String getName() {
	// return name;
	// }
	//
	// public void setName(String name) {
	// this.name = name;
	// }

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public boolean isDirty() {

		// return model.containsStuff() && diagrams.contaisStuff() && dirty;

		return dirty;
	}

	public void setDirty(boolean dirty) {
		this.dirty = dirty;
		triggerListeners();
	}

	protected void triggerListeners() {
		for (IProjectListener listener : listeners) {
			listener.listen(this);
		}

	}

	public void addListener(IProjectListener listener) {
		listeners.add(listener);
	}

	public void removeListener(IProjectListener listener) {
		listeners.remove(listener);
	}

	public void clearListeners() {
		listeners.clear();
	}

	public abstract void compileIndexes();

}
